<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>汽车衡称重系统</title>
	<link href="__STATIC__/css/common.css" rel="stylesheet">
	<link rel="stylesheet" href="__STATIC__/css/index.css">
	<style>
		.ms-controller{
			display:none;
		}
	</style>
</head>
<body ms-controller="view" class="ms-controller" ms-visible="display_main">
	<div class="header">
		<div class="header-box">
			<ul class="menu-box">
				<li class="menu-item" ms-class="menu-active:menu_label == 'scale'" ms-click="changeMenu('scale')">称重</li>
				<li class="menu-item" ms-class="menu-active:menu_label == 'system'" ms-click="changeMenu('system')">系统维护</li>
				<li class="menu-item" ms-class="menu-active:menu_label == 'report'" ms-click="changeMenu('report')">统计报表</li>
				<li class="menu-item" ms-class="menu-active:menu_label == 'function'" ms-click="changeMenu('function')">财务核算</li>
				<li class="menu-item"><a style="color:blue;" target="_blank" href="/home/index/insertByHand">手动补单</a></li>
			</ul>
		</div>
	</div>

	<div class="main">
		<div class="content">
			<div class="system-menu">
				<ul>
					<li class="system-menu-item" ms-class="system-menu-active:system_display == 'user'" ms-click="changeSystemDisplay('user')">用户管理</li>
					<li class="system-menu-item" ms-class="system-menu-active:system_display == 'truck'" ms-click="changeSystemDisplay('truck')">车辆管理</li>
					<li class="system-menu-item" ms-class="system-menu-active:system_display == 'customer'" ms-click="changeSystemDisplay('customer')">单位管理</li>
					<li class="system-menu-item" ms-class="system-menu-active:system_display == 'goods'" ms-click="changeSystemDisplay('goods')">物资管理</li>
					<li class="system-menu-item" ms-class="system-menu-active:system_display == 'excavator'" ms-click="changeSystemDisplay('excavator')">钩机管理</li>
					<li class="system-menu-item" ms-class="system-menu-active:system_display == 'house'" ms-click="changeSystemDisplay('house')" ms-visible="user_info.isManager == 1">磅房管理</li>
					<li class="system-menu-item" ms-class="system-menu-active:system_display == 'truck_type'" ms-click="changeSystemDisplay('truck_type')">车型管理</li>
					<li class="system-menu-item" ms-class="system-menu-active:system_display == 'position'" ms-click="changeSystemDisplay('position')">发货位置</li>
					<li class="system-menu-item" ms-class="system-menu-active:system_display == 'route'" ms-click="changeSystemDisplay('route')">发运路线</li>
					<li class="system-menu-item" ms-class="system-menu-active:system_display == 'config'" ms-click="changeSystemDisplay('config')" ms-visible="user_info.isManager == 1">配置信息</li>
					<li class="system-menu-item" ms-class="system-menu-active:system_display == 'number'" ms-click="changeSystemDisplay('number')">流水号</li>
				</ul>
			</div>
			<div class="system-box">
				<div class="system-item" ms-visible="system_display == 'user'">
					<div class="system-item-top">
						<p class="system-top-title">用户管理</p>
						<button class="btn-system" ms-visible="user_info.isManager == 1" ms-click="changeUserDis('add','')" ms-visible="user_dis == 'list'">新增</button>
					</div>
					<div class="system-user">
						<table class="system-table" border="1" cellspacing="0" style="width:90%;font-size:14px;table-layout:fixed" ms-visible="user_dis == 'list'">
							<tr>
								<td style="text-align:center;">用户名</td>
								<td align="center">操作</td>
							</tr>
							<tr ms-repeat-els="user_list" class="tr-hover">
								<td align="center" ms-text="els.userName"></td>
								<td>
									<button class="btn-system-operator" ms-visible="user_info.isManager == 1" ms-click="resetUserPwd(els)">重置密码</button>
									<button class="btn-system-operator" ms-visible="user_info.isManager == 1" ms-click="changeUserDis('power',els)">设置权限</button>
									<button class="btn-system-operator" ms-visible="user_info.isManager == 1" ms-click="deleteUser(els)">删除用户</button>
									<button class="btn-system-operator" ms-visible="els.userId == user_info.userId" ms-click="changeUserDis('edit',els)">修改密码</button>
								</td>
							</tr>
						</table>
						<div class="user-power">
							<table class="" border="0" cellspacing="10" style="width:90%;font-size:14px;table-layout:fixed" ms-visible="user_dis == 'power'">
								<tr>
									<td colspan="4" align="center" style="height:60px;line-height:60px;font-size:18px;" ms-text="user_edit.userName"></td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<input type="checkbox" ms-attr-checked="user_p.editBill" ms-click="changerPower('editBill')">编辑磅单
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<input type="checkbox" ms-attr-checked="user_p.delBill" ms-click="changerPower('delBill')">删除磅单
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<input type="checkbox" ms-attr-checked="user_p.delEmpty" ms-click="changerPower('delEmpty')">删除皮重
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<input type="checkbox" ms-attr-checked="user_p.delFull" ms-click="changerPower('delFull')">删除毛重
										</label>
									</td>
									
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<input type="checkbox" ms-attr-checked="user_p.printBill" ms-click="changerPower('printBill')">补充打印
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<input type="checkbox" ms-attr-checked="user_p.changeWeigh" ms-click="changerPower('changeWeigh')">编辑重量
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<input type="checkbox"  ms-attr-checked="user_p.changeModel" ms-click="changerPower('changeModel')">切换模式
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<input type="checkbox" ms-attr-checked="user_p.searchCount" ms-click="changerPower('searchCount')">查询统计
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<input type="checkbox" ms-attr-checked="user_p.sql" ms-click="changerPower('sql')">SQL&nbsp;操作
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<input type="checkbox" ms-attr-checked="user_p.accounting" ms-click="changerPower('accounting')">财务核算
										</label>
									</td>
								</tr>
								<tr>
									<td align="center" colspan="4">
										<button class="btn-system-big" ms-click="saveUser">保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</button>
										<button class="btn-system-big left-20" ms-click="changeUserDis('list','')">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
									</td>
								</tr>
							</table>
							<table class="" border="0" cellspacing="0" style="width:90%;font-size:14px;table-layout:fixed" ms-visible="user_dis == 'add'">
									<tr>
										<td align="center" style="height:60px;">
											<label class="label-for-user" for="">
												用户姓名：<input class="system-input-normal" type="text" ms-duplex="user_add.userName">
											</label>
										</td>
										<td align="center" style="height:60px;">
											<label class="label-for-user" for="">
												管&nbsp;&nbsp;理&nbsp;&nbsp;员：
												<select  style="display:inline-block;width:200px;height:30px;" ms-duplex="user_add.isManager">
													<option value="undefined" selected disabled>请选择是否为管理员</option>
													<option value="0">否</option>
													<option value="1">是</option>
												</select>
											</label>
										</td>
									</tr>
									<tr>
										<td align="center" style="height:60px;">
											<label class="label-for-user" for="">
												用户密码：<input class="system-input-normal" type="password" ms-duplex="user_add.userPwd">
											</label>
										</td>
										<td align="center" style="height:60px;">
											<label class="label-for-user" for="">
												确认密码：<input class="system-input-normal" type="password" ms-duplex="user_add.checkPwd">
											</label>
										</td>
									</tr>
									<tr>
										<td align="center" colspan="2">
											<button class="btn-system-big" ms-click="saveUser">保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</button>
											<button class="btn-system-big left-20" ms-click="changeUserDis('list','')">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
										</td>
									</tr>
							</table>
							<table class="" border="0" cellspacing="0" style="width:90%;font-size:14px;table-layout:fixed" ms-visible="user_dis == 'edit'">
								<tr>
									<td align="center" style="height:60px;">
										<label class="label-for-user" for="">
											用户姓名：<input class="system-input-normal" type="text" ms-attr-readonly="user_dis == 'edit'" ms-duplex="user_edit.userName">
										</label>
									</td>
									<td align="center" style="height:60px;">
										<label class="label-for-user" for="">
											旧的密码：<input class="system-input-normal" type="password" ms-duplex="user_edit.oldPwd">
										</label>
										
									</td>
								</tr>
								<tr>
									<td align="center" style="height:60px;">
										<label class="label-for-user" for="">
											用户密码：<input class="system-input-normal" type="password" ms-duplex="user_edit.userPwd">
										</label>
									</td>
									<td align="center" style="height:60px;">
										<label class="label-for-user" for="">
											确认密码：<input class="system-input-normal" type="password" ms-duplex="user_edit.checkPwd">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center" colspan="2">
										<button class="btn-system-big" ms-click="saveUser">保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</button>
										<button class="btn-system-big left-20" ms-click="changeUserDis('list','')">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
									</td>
								</tr>
							</table>
						</div>
					</div>
				</div>
				<div class="system-item" ms-visible="system_display == 'truck'">
					<div class="system-item-top">
						<p class="system-top-title">车辆管理</p>
						<button class="btn-system" ms-click="changeTruckDis('add','')" ms-visible="truck_dis == 'list'">新增</button>
					</div>
					<div class="system-user">
						<table class="system-table" border="1" cellspacing="0" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="truck_dis == 'list'">
							<tr>
								<td align="center" style="padding:5px 0">车牌号码</td>
								<td align="center" style="padding:5px 0">司机姓名</td>
								<td align="center" style="padding:5px 0">车主姓名</td>
								<td align="center" style="padding:5px 0">车辆型号</td>
								<td align="center" style="padding:5px 0">空车重量</td>
								<td align="center" style="padding:5px 0">检皮日期</td>
								<td align="center" style="padding:5px 0">检皮人员</td>
								<td align="center" style="padding:5px 0">操作</td>
							</tr>
							<tr class="tr-hover" ms-repeat-el="truck_list">
								<td style="padding:5px 0" ms-text="el.truckCode"></td>
								<td style="padding:5px 0" ms-text="el.driver"></td>
								<td style="padding:5px 0" ms-text="el.truckOwner"></td>
								<td style="padding:5px 0" ms-text="el.typeName"></td>
								<td style="padding:5px 0" ms-text="el.emptyWeigh"></td>
								<td style="padding:5px 0" ms-text="el.weighDateDesc"></td>
								<td style="padding:5px 0" ms-text="el.emptyOperator"></td>
								<td style="padding:5px 0">
									<button class="btn-system-operator" ms-click="changeTruckDis('edit',el)">修改</button>|
									<button class="btn-system-operator" ms-click="delTruck(el.truckId)">删除</button>
								</td>
							</tr>
						</table>
						<table border="0" cellspacing="10" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="truck_dis == 'add'">
							<tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											车牌号码：<input class="system-input-normal" type="text" ms-duplex="truck_add.truckCode">
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											司机姓名：<input class="system-input-normal" type="text" ms-duplex="truck_add.driver">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											车主姓名：<input class="system-input-normal" type="text" ms-duplex="truck_add.truckOwner">
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											车辆型号：
											<select style="display:inline-block;width:200px;"  ms-duplex="truck_add.truckType">
												<option value="">请选择车辆型号</option>
												<option ms-repeat-el="truck_type_list" ms-attr-value="el.typeId">(|el.typeName|)</option>
											</select>
										</label>
									</td>
								</tr>
								<tr>
									<td align="center" colspan="2">
										<button class="btn-system-big" ms-click="saveTruck">保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</button>
										<button class="btn-system-big left-20" ms-click="changeTruckDis('list','')">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
									</td>
								</tr>
							</tr>
						</table>
						<table border="0" cellspacing="10" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="truck_dis == 'edit'">
							<tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											车牌号码：<input class="system-input-normal" type="text" readonly="true" ms-duplex="truck_edit.truckCode">
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											司机姓名：<input class="system-input-normal" type="text" ms-duplex="truck_edit.driver">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											车主姓名：<input class="system-input-normal" type="text" ms-duplex="truck_edit.truckOwner">
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											车辆型号：
											<select style="display:inline-block;width:200px;"  ms-duplex="truck_edit.truckType">
												<option value="">请选择车辆型号</option>
												<option ms-repeat-el="truck_type_list" ms-attr-value="el.typeId">(|el.typeName|)</option>
											</select>
										</label>
									</td>
								</tr>
								<tr>
									<td align="center" colspan="2">
										<button class="btn-system-big" ms-click="saveTruck">保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</button>
										<button class="btn-system-big left-20" ms-click="changeTruckDis('list','')">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
									</td>
								</tr>
							</tr>
						</table>
					</div>
				</div>
				<div class="system-item" ms-visible="system_display == 'customer'">				
					<div class="system-item-top">
						<p class="system-top-title">单位管理</p>
						<button class="btn-system" ms-click="customerToEdit(0,[])" ms-visible="customer_dis == 'list'">新增</button>
					</div>
					<div class="system-user">
						<table class="system-table" border="1" cellspacing="0" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="customer_dis == 'list'">
							<tr>
								<td align="center" style="padding:5px 0">单位名称</td>
								<td align="center" style="padding:5px 0">单位地址</td>
								<td align="center" style="padding:5px 0">联系电话</td>
								<td align="center" style="padding:5px 0">所属磅房</td>
								<td align="center" style="padding:5px 0">操作</td>
							</tr>
							<tr class="tr-hover" ms-repeat-el="customer_list">
								<td style="padding:5px 0" ms-text="el.customerName"></td>
								<td style="padding:5px 0" ms-text="el.address"></td>
								<td style="padding:5px 0" ms-text="el.phone"></td>
								<td style="padding:5px 0" ms-text="el.receiveHouse"></td>
								<td style="padding:5px 0">
									<button class="btn-system-operator" ms-click="customerToEdit(el.customerId,el)">修改</button>|
									<button class="btn-system-operator" ms-click="toDelCustomer(el.customerId)">删除</button>
								</td>
							</tr>
						</table>
						<table border="0" cellspacing="10" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="customer_dis == 'edit'">
							<tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											单位名称：<input class="system-input-normal" type="text" ms-duplex="customer_edit.customerName">
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											单位地址：<input class="system-input-normal" type="text" ms-duplex="customer_edit.address">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											联系电话：<input class="system-input-normal" type="text" ms-duplex="customer_edit.phone">
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<span>所属磅房：</span>
											<div id="customer-selected">
												<p class="customer-select" ms-repeat-sl="house_list" ms-text="sl.houseName" ms-click="setCustomerSelect($index)"></p>
											</div>
										</label>
									</td>
								</tr>
								<tr>
									<td align="center" colspan="2">
										<button class="btn-system-big" ms-click="customerSave">保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</button>
										<button class="btn-system-big left-20" ms-click="customerReturn()">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
									</td>
								</tr>
							</tr>
						</table>
					</div>
				</div>
				<div class="system-item" ms-visible="system_display == 'goods'">				
					<div class="system-item-top">
						<p class="system-top-title">物资管理</p>
						<button class="btn-system" ms-visible="goods_dis == 'list'" ms-click="goodsEdit(0,[])">新增</button>
					</div>
					<div class="system-user">
						<table class="system-table" border="1" cellspacing="0" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="goods_dis == 'list'">
							<tr>
								<td align="center" style="padding:5px 0">物资名称</td>
								<td align="center" style="padding:5px 0">操作</td>
							</tr>
							<tr class="tr-hover" ms-repeat-el="goods_list">
								<td style="padding:5px 0" ms-text="el.goodsName"></td>
								<td style="padding:5px 0">
									<button class="btn-system-operator" ms-click="goodsEdit(el.goodsId,el)">修改</button>|
									<button class="btn-system-operator" ms-click="toDelGoods(el.goodsId)">删除</button>
								</td>
							</tr>
						</table>
						<table border="0" cellspacing="10" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="goods_dis == 'edit'">
							<tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											物资名称：<input class="system-input-normal" type="text" ms-duplex="goods_edit.goodsName">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<button class="btn-system-big" ms-click="goodsSave()">保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</button>
										<button class="btn-system-big left-20" ms-click="goodsReturn">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
									</td>
								</tr>
							</tr>
						</table>
					</div>
				</div>
				<div class="system-item" ms-visible="system_display == 'excavator'">			
					<div class="system-item-top">
						<p class="system-top-title" ms-visible="excavator_dis == 'list'">钩机管理</p>
						<button class="btn-system" ms-click="excavatorEdit(0,[])">新增</button>
					</div>
					<div class="system-user">
						<table class="system-table" border="1" cellspacing="0" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="excavator_dis == 'list'">
							<tr>
								<td align="center" style="padding:5px 0">钩机号码</td>
								<td align="center" style="padding:5px 0">操作</td>
							</tr>
							<tr class="tr-hover" ms-repeat-el="excavator_list">
								<td style="padding:5px 0" ms-text="el.excavatorCode"></td>
								<td style="padding:5px 0">
									<button class="btn-system-operator" ms-click="excavatorEdit(el.excavatorId,el)">修改</button>|
									<button class="btn-system-operator" ms-click="toDelExcavator(el.excavatorId)">删除</button>
								</td>
							</tr>
						</table>
						<table border="0" cellspacing="10" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="excavator_dis == 'edit'">
							<tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											钩机号码：<input class="system-input-normal" type="text" ms-duplex="excavator_edit.excavatorCode">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<button class="btn-system-big" ms-click="excavatorSave()">保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</button>
										<button class="btn-system-big left-20" ms-click="excavatorReturn()">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
									</td>
								</tr>
							</tr>
						</table>
					</div>
				</div>
				<div class="system-item" ms-visible="system_display == 'house'">				
					<div class="system-item-top">
						<p class="system-top-title">磅房管理</p>
						<button class="btn-system" ms-visible="house_dis == 'list'" ms-click="houseEdit(0,[])">新增</button>
					</div>
					<div class="system-user">
						<table class="system-table" border="1" cellspacing="0" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="house_dis == 'list'">
							<tr>
								<td align="center" style="padding:5px 0">磅房名称</td>
								<td align="center" style="padding:5px 0">操作</td>
							</tr>
							<tr class="tr-hover" ms-repeat-el="house_list">
								<td style="padding:5px 0" ms-text="el.houseName"></td>
								<td style="padding:5px 0">
									<button class="btn-system-operator" ms-click="houseEdit(el.houseId,el)">修改</button>|
									<button class="btn-system-operator" ms-click="toDelHouse(el.houseId)">删除</button>
								</td>
							</tr>
						</table>
						<table border="0" cellspacing="10" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="house_dis == 'edit'">
							<tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											磅房名称：<input class="system-input-normal" type="text" ms-duplex="house_edit.houseName">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<button class="btn-system-big" ms-click="houseSave()">保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</button>
										<button class="btn-system-big left-20" ms-click="houseReturn()">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
									</td>
								</tr>
							</tr>
						</table>
					</div>
				</div>
				<div class="system-item" ms-visible="system_display == 'truck_type'">			
					<div class="system-item-top">
						<p class="system-top-title">车型管理</p>
						<button class="btn-system" ms-visible="truck_type_dis == 'list'" ms-click="trucktypeEdit(0,[])">新增</button>
					</div>
					<div class="system-user">
						<table class="system-table" border="1" cellspacing="0" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="truck_type_dis == 'list'">
							<tr>
								<td align="center" style="padding:5px 0">车辆类型</td>
								<td align="center" style="padding:5px 0">操作</td>
							</tr>
							<tr class="tr-hover" ms-repeat-el="truck_type_list">
								<td style="padding:5px 0" ms-text="el.typeName"></td>
								<td style="padding:5px 0">
									<button class="btn-system-operator" ms-click="trucktypeEdit(el.typeId,el)">修改</button>|
									<button class="btn-system-operator" ms-click="toDelTrucktype(el.typeId)">删除</button>
								</td>
							</tr>
						</table>
						<table border="0" cellspacing="10" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="truck_type_dis == 'edit'">
							<tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											车辆型号：<input class="system-input-normal" type="text" ms-duplex="truck_type_edit.typeName">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<button class="btn-system-big" ms-click="trucktypeSave()">保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</button>
										<button class="btn-system-big left-20" ms-click="trucktypeReturn()">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
									</td>
								</tr>
							</tr>
						</table>
					</div>
				</div>

				<div class="system-item" ms-visible="system_display == 'position'">				
					<div class="system-item-top">
						<p class="system-top-title">发货位置管理</p>
						<button class="btn-system" ms-visible="position_dis == 'list'" ms-click="positionEdit(0,[])">新增</button>
					</div>
					<div class="system-user">
						<table class="system-table" border="1" cellspacing="0" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="position_dis == 'list'">
							<tr>
								<td align="center" style="padding:5px 0">发货位置</td>
								<td align="center" style="padding:5px 0">所属单位</td>
								<td align="center" style="padding:5px 0">操作</td>
							</tr>
							<tr class="tr-hover" ms-repeat-el="position_list">
								<td style="padding:5px 0" ms-text="el.position"></td>
								<td style="padding:5px 0" ms-text="el.unit"></td>
								<td style="padding:5px 0">
									<button class="btn-system-operator" ms-click="positionEdit(el.positionId,el)">修改</button>|
									<button class="btn-system-operator" ms-click="toDelPosition(el.positionId)">删除</button>
								</td>
							</tr>
						</table>
						<table border="0" cellspacing="10" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="position_dis == 'edit'">
							<tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											发货位置：<input class="system-input-normal" type="text" ms-duplex="position_edit.position">
										</label>
									</td>
									<td align="center">
										<label class="label-for-user">所属单位：
											<select style="display:inline-block;width:200px;" ms-duplex="position_edit.customerId">
												<option selected disabled value="0">请选择</option>
												<option ms-repeat-kl="customer_list" ms-attr-value="kl.customerId">(|kl.customerName|)</option>
											</select>
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<button class="btn-system-big" ms-click="positionSave()">保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</button>
										<button class="btn-system-big left-20" ms-click="positionReturn()">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
									</td>
								</tr>
							</tr>
						</table>
					</div>
				</div>

				<div class="system-item" ms-visible="system_display == 'route'">				
					<div class="system-item-top">
						<p class="system-top-title">发运路线管理</p>
						<button class="btn-system" ms-visible="route_dis == 'list'" ms-click="routeEdit(0,[])">新增</button>
					</div>
					<div class="system-user">
						<table class="system-table" border="1" cellspacing="0" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="route_dis == 'list'">
							<tr>
								<td align="center" style="padding:5px 0">发运路线</td>
								<td align="center" style="padding:5px 0">操作</td>
							</tr>
							<tr class="tr-hover" ms-repeat-el="route_list">
								<td style="padding:5px 0" ms-text="el.route"></td>
								<td style="padding:5px 0">
									<button class="btn-system-operator" ms-click="routeEdit(el.routeId,el)">修改</button>|
									<button class="btn-system-operator" ms-click="toDelRoute(el.routeId)">删除</button>
								</td>
							</tr>
						</table>
						<table border="0" cellspacing="10" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="route_dis == 'edit'">
							<tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											发运路线：<input class="system-input-normal" type="text" ms-duplex="route_edit.route">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<button class="btn-system-big" ms-click="routeSave()">保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</button>
										<button class="btn-system-big left-20" ms-click="routeReturn()">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
									</td>
								</tr>
							</tr>
						</table>
					</div>
				</div>

				<div class="system-item" ms-visible="system_display == 'config'">				
					<div class="system-item-top">
						<p class="system-top-title">配置信息</p>
						<button class="btn-system" ms-visible="config_dis == 'list'" ms-click="configEdit(0,[])">新增</button>
					</div>
					<div class="system-user">
						<table class="system-table" border="1" cellspacing="0" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="config_dis == 'list'">
							<tr>
								<td align="center" style="padding:5px 0">磅房名称</td>
								<td align="center" style="padding:5px 0">公司名称</td>
								<td align="center" style="padding:5px 0">前置编号</td>
								<!-- <td align="center" style="padding:5px 0">返回地址</td> -->
								<td align="center" style="padding:5px 0">称重模式</td>
								<td align="center" style="padding:5px 0">正式车牌长度</td>
								<td align="center" style="padding:5px 0">临时车牌长度</td>
								<!-- <td align="center" style="padding:5px 0">过磅单头部</td>
								<td align="center" style="padding:5px 0">过磅单尾部</td> -->
								<td align="center" style="padding:5px 0">车牌类型</td>
								<!-- <td align="center" style="padding:5px 0">过磅单编号长度</td> -->
								<td align="center" style="padding:5px 0">端口号</td>
								<td align="center" style="padding:5px 0">波特率</td>
								<td align="center" style="padding:5px 0">数据位</td>
								<td align="center" style="padding:5px 0">校验位</td>
								<td align="center" style="padding:5px 0">停止位</td>
								<td align="center" style="padding:5px 0">纸&nbsp;&nbsp;&nbsp;型</td>
								<td align="center" style="padding:5px 0">过磅单页面规格</td>
								<td align="center" style="padding:5px 0">过磅单打印区域</td>
								<td align="center" style="padding:5px 0">报表页面规格</td>
								<td align="center" style="padding:5px 0">报表打印区域</td>
								<td align="center" style="padding:5px 0">操作</td>
							</tr>
							<tr class="tr-hover" ms-repeat-el="config_list">
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.houseName"></td>
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.company"></td>
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.codeLeft"></td>
								<!-- <td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.backupUrl"></td> -->
								<td align="center" style="padding:5px 0;word-wrap : break-word;">
									<span ms-visible="el.weighModel == '0'">预存车皮</span>
									<span ms-visible="el.weighModel == '1'">车车回皮</span>
								</td>
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.normalLen"></td>
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.tempLen"></td>
								<!-- <td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.printHead"></td>
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.printEnd"></td> -->
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.codeType"></td>
								<!-- <td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.codeLen"></td> -->
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.portName"></td>
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.baudRate"></td>
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.dataBit"></td>
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.checkBit"></td>
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.stopBit"></td>
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.pageName"></td>
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.codePagearea"></td>
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.codePrintarea"></td>
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.reportPagearea"></td>
								<td align="center" style="padding:5px 0;word-wrap : break-word;" ms-text="el.reportPrintarea"></td>
								<td style="padding:5px 0">
									<button class="btn-system-operator" ms-click="configEdit(el.configId,el)">修改</button>|
									<button class="btn-system-operator" ms-click="toDelConfig(el.configId)">删除</button>
								</td>
							</tr>
						</table>
						<table border="0" cellspacing="10" style="width:99%;font-size:14px;table-layout:fixed" ms-visible="config_dis == 'edit'">
							<tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">磅房名称：</span>
											<select style="display:inline-block;width:200px;height:30px;line-height:30px;" ms-visible="config_edit.configId <= 0" ms-duplex="config_edit.houseId">
												<option value="" disabled="" value="">请选择磅房</option>
												<option ms-repeat-el="house_list" ms-attr-value="el.houseId" ms-text="el.houseName"></option>
											</select>
											<select style="display:inline-block;width:200px;height:30px;line-height:30px;" ms-visible="config_edit.configId > 0" ms-duplex="config_edit.houseId">
												<option value="" disabled>请选择磅房</option>
												<option ms-repeat-el="house_list" ms-attr-value="el.houseId" disabled ms-text="el.houseName"></option>
											</select>
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">公司名称：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.company">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">前置编号：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.codeLeft">
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">返回地址：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.backupUrl">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">正式车牌长度：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.normalLen">
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">临时车牌长度：</span><input class="system-input-normal" type="text" ms-duplex="config_edit.tempLen">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">过磅单头部：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.printHead">
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">过磅单尾部：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.printEnd">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">称重模式：</span>
											<select style="display:inline-block;width:200px;height:30px;line-height:30px;" ms-duplex="config_edit.weighModel">
												<option value="" disabled="">请选择称重模式</option>
												<option value="0">预存车皮</option>
												<option value="1">车车回皮</option>
											</select>
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">车牌类型：</span>
											<select style="display:inline-block;width:200px;height:30px;line-height:30px;" ms-duplex="config_edit.codeType">
												<option disabled value="">请选择车辆型号</option>
												<option value="0">临时车牌</option>
												<option value="1">正式车牌</option>
											</select>
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">端口号：</span>
											<select style="display:inline-block;width:200px;height:30px;line-height:30px;" ms-duplex="config_edit.portName">
												<option value="">请选择端口号</option>
												<option value="COM1">COM1</option>
												<option value="COM2">COM2</option>
												<option value="COM3">COM3</option>
												<option value="COM4">COM4</option>
												<option value="COM5">COM5</option>
												<option value="COM6">COM6</option>
												<option value="COM7">COM7</option>
												<option value="COM8">COM8</option>
												<option value="COM9">COM9</option>
												<option value="COM10">COM10</option>
												<option value="COM11">COM11</option>
												<option value="COM12">COM12</option>
												<option value="COM13">COM13</option>
												<option value="COM14">COM14</option>
												<option value="COM15">COM15</option>
											</select>
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">波特率：</span>
											<select style="display:inline-block;width:200px;height:30px;line-height:30px;" ms-duplex="config_edit.baudRate">
												<option value="">请选择波特率</option>
												<option value="1200">1200</option>
												<option value="1800">1800</option>
												<option value="2400">2400</option>
												<option value="4800">4800</option>
												<option value="9600">9600</option>
												<option value="14400">14400</option>
												<option value="19200">19200</option>
											</select>
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">数据位：</span>
											<select style="display:inline-block;width:200px;height:30px;line-height:30px;" ms-duplex="config_edit.dataBit">
												<option value="7">7</option>
												<option value="8">8</option>
											</select>
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">校验位：</span>
											<select style="display:inline-block;width:200px;height:30px;line-height:30px;" ms-duplex="config_edit.checkBit">
												<option value="None">无</option>
												<option value="奇">奇</option>
												<option value="偶">偶</option>
												<option value="标志">标志</option>
												<option value="空格">空格</option>
											</select>
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">停止位：</span>
											<select style="display:inline-block;width:200px;height:30px;line-height:30px;" ms-duplex="config_edit.stopBit">
												<option value="1">1</option>
												<option value="2">2</option>
											</select>
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">纸&nbsp;&nbsp;&nbsp;型：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.pageName">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">过磅单页面规格：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.codePagearea">
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">过磅单打印区域：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.codePrintarea">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">报表页面规格：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.reportPagearea">
										</label>
									</td>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">报表打印区域：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.reportPrintarea">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">是否测试模式：</span>
											<select style="display:inline-block;width:200px;height:30px;line-height:30px;" ms-duplex="config_edit.isTest">
												<option value="0">否</option>
												<option value="1">是</option>
											</select>
										</label>
									</td>
									<td align="center">
										<label for="" class="label-for-user">
											<span class="system-input-lab">是否调试模式</span>
											<select style="display:inline-block;width:200px;height:30px;line-height:30px;" ms-duplex="config_edit.isDebug">
												<option value="0">否</option>
												<option value="1">是</option>
											</select>
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">时间区间报表：</span>
											<select style="display:inline-block;width:200px;height:30px;line-height:30px;" ms-duplex="config_edit.timeAreareport">
												<option value="0">不启用</option>
												<option value="1">启用</option>
											</select>
										</label>
									</td>
									<td align="center">
										<label for="" class="label-for-user">
											<span class="system-input-lab">过磅间隔(分)</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.weighInterval">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											<span class="system-input-lab">是否启用视频：</span>
											<select style="display:inline-block;width:200px;height:30px;line-height:30px;" ms-duplex="config_edit.video">
												<option value="0">不启用</option>
												<option value="1">启用</option>
											</select>
										</label>
									</td>
									<td align="center">
										<label for="" class="label-for-user">
											<span class="system-input-lab">摄像头IP地址：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.cameraIp">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label for="" class="label-for-user">
											<span class="system-input-lab">摄像头用户名：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.cameraUser">
										</label>
									</td>
									<td align="center">
										<label for="" class="label-for-user">
											<span class="system-input-lab">摄像头密码：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.cameraPwd">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label for="" class="label-for-user">
											<span class="system-input-lab">图片本地存储地址：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.picUrl">
										</label>
									</td>
									<td align="center">
										<label for="" class="label-for-user">
											<span class="system-input-lab">图片远端存储地址：</span>
											<input class="system-input-normal" type="text" ms-duplex="config_edit.serverPicurl">
										</label>
									</td>
								</tr>
								<tr>
									<td align="center" colspan="2">
										<button class="btn-system-big" ms-click="configSave()">保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</button>
										<button class="btn-system-big left-20" ms-click="configReturn()">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
									</td>
								</tr>
							</tr>
						</table>
					</div>
				</div>
				<div class="system-item" ms-visible="system_display == 'number'">				
					<div class="system-item-top">
						<p class="system-top-title">流水号</p>
					</div>
					<div class="system-user">
						<table border="0" cellspacing="10" style="width:99%;font-size:14px;table-layout:fixed">
							<tr>
								<tr>
									<td align="center">
										<label class="label-for-user" for="">
											流水号：<input class="system-input-normal" type="text" ms-duplex="serialNumber">
										</label>
									</td>
									<td align="center">
										<button class="btn-system-big" ms-click="serialnumberSave()">保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</button>
									</td>
								</tr>
							</tr>
						</table>
					</div>
				</div>
			</div>
			<div class="clear"></div>
		</div>
	</div>

	<script src="__STATIC__/js/jquery.min.js"></script>
	<script src="__STATIC__/js/layer/layer.js"></script>
	<script src="__STATIC__/js/avalon.js"></script>
	<script src="__STATIC__/js/common.js"></script>
	<script src="__STATIC__/js/jquery.cookie.min.js"></script>
	<script src="__STATIC__/js/jQuery.md5.js"></script>
	<script src="__STATIC__/js/logic.js"></script>
	<script src="__STATIC__/js/validator.js"></script>
	<script>
		jQuery(document).ready(function(){
			avalon.config({
	          interpolate : ["(|","|)"]
	        });


	        var vm = avalon.define({
	        	$id:'view',
	        	houseId:0,
	        	menu_label:'system',
	        	user_info:{},
	        	user_list:[],
	        	user_power:[],
	        	truck_code_list:[],
	        	truck_type_list:[],
	        	excavator_list:[],
	        	customer_list:[],
	        	house_list:[],
	        	truck_list:[],
	        	config_list:[],
	        	route_list:[],
	        	position_list:[],
	        	customer_receive_list:[],
	        	goods_list:[],
	        	serialNumber:'',
	        	config:{weighModel:0,codeType:0,codeLen:3,codePagearea:'',codePrintarea:''},
	        	display_main:true,
	        	login_box_display:false,/*是否显示切换用户界面*/
	        	user_login:{userName:'',userPwd:'',error:false,msg:''},
	        	lock_box_display:false,/*是否显示屏幕锁定界面*/
	        	system_display:'user',/*系统维护菜单显示字符串*/
	        	system_dis:{user:'list',truck:'list',customer:'list',goods:'list',excavator:'list',house:'list',truck_type:'list',config:'list'},/*系统管理中内部显示字符串*/
	        	user_edit:{userPwd:'',oldPwd:'',checkPwd:''},/*记录用户编辑时的内容*/
	        	user_add:{},
	        	user_p:{editBill:false, delBill:false, delEmpty:false, delFull:false, printBill:false, changeWeigh:false,changeModel:false,searchCount:false,sql:false,accounting:false},/*记录编辑用户权限*/
	        	user_dis:'list',
	        	truck_dis:'list',/*记录车辆显示模式*/
	        	truck_edit:{},/*记录车两编辑信息*/
	        	truck_add:{truckCode:'',driver:'',truckOwner:'',truckType:''},
	        	customer_edit:{customerId:'',customerName:'',phone:'',address:'',receiveHouse:'',dataFlag:1},
	        	customer_dis:'list',
	        	goods_dis:'list',
	        	goods_edit:{goodsId:0,goodsName:'',dataFlag:1},
	        	excavator_dis:'list',
	        	excavator_edit:{excavatorId:0,excavatorCode:'',dataFlag:1},
	        	house_dis:'list',
	        	house_edit:{houseId:0,houseName:'',dataFlag:1},
	        	truck_type_dis:'list',
	        	truck_type_edit:{typeId:0,typeName:''},
	        	config_dis:'list',
	        	config_edit:{configId:0,company:'',codeLeft:'',backupUrl:'',weighModel:0,isTest:0,isDebug:0,normalLen:7,tempLen:3,lockTime:0,printHead:'',printEnd:'',dataFlag:1,houseId:0,codeType:0,codeLen:0,portName:'COM1',baudRate:'4800',dataBit:8,checkBit:'None',stopBit:1,cacheLen:10,codePrintarea:'220mm,85mm',codePagearea:'2200,855',reportPagearea:'3700,2200',reportPrintarea:'3600mm,2200mm',pageName:'报表',timeAreareport:0,weighInterval:0,video:0,cameraIp:'',cameraUser:'',cameraPwd:'',picUrl:'',serverPicurl:''},
	        	position_dis:'list',
	        	position_edit:{positionId:0,position:'',dataFlag:1,customerId:0},
	        	route_dis:'list',
	        	route_edit:{routeId:0,route:'',dataFlag:1},
	        	load:function(){
	        		/*if(vm.user_info.isManager < 1){
        				TX.msg('您没有权限访问此页',{time:3000});
        				window.location.href = '/home/index/index';
        				return;
        			}*/
	        		$.post(logic_urls.index,{},
	        			function(data,textStatus){
	        				var json = TX.toJson(data);
	        				var t = Date.parse(new Date()) / 1000;
	        				if(Math.abs(t - json.time) >= 3000){
	        					var tt = new Date(parseInt(json.time) * 1000).toLocaleString();
	        					alert('当前系统与服务器时间不同步,服务器时间为:' + tt + ".请手动修改系统时间");
	        					vm.display_main = false;
	        					return;
	        				}
	        				for(var k in json.data){
	        					vm[k] = json.data[k];
	        				}
	        				console.log(vm.customer_list);
	        				vm.user_power = vm.user_info.power.split(',');
	        				vm.resetCustomerSelect();
	        				console.log(vm.house_list);
	        				avalon.scan();
	        			}
	        		);
	        	},
	        	changeMenu:function(m){
	        		if(m == 'system'){
	        			return;
	        		}
	        		if(m == 'report'){
	        			window.open('/home/index/report');
	        			return;
	        		}
	        		if(m == 'function'){
	        			window.location.href = '/home/index/accounting';
	        			return;
	        		}
	        		window.location.href = "/home/index/index";
	        	},
	        	changeSystemDisplay:function(e){
	        		vm.system_display = e;
	        	},
	        	/***
	        	*
	        	*用户相关
	        	*
	        	***/
	        	/*切换用户功能模式*/
	        	changeUserDis:function(tp,el){
	        		if(tp == 'list'){
	        			vm.user_dis = 'list';
	        			return;
	        		}
	        		if(tp == 'add'){
	        			vm.user_add = {
	        				userName:'',
	        				userPwd:'',
	        				checkPwd:'',
	        				power:'',
	        				isManager:0
	        			};
	        			vm.user_dis = 'add';
	        			avalon.scan();
	        			return;
	        		}
	        		if(tp == 'power'){
	        			vm.getPower(el.power);
	        			vm.user_edit = el;
	        			vm.user_dis = 'power';
	        			avalon.scan();
	        			return;
	        		}
	        		if(tp == 'edit'){
	        			console.log(el);
	        			el.userPwd = '';
		        		el.oldPwd = '';
		        		el.checkPwd = '';
	        			vm.user_edit = el;
	        			vm.user_dis = 'edit';
	        			console.log(vm.user_edit);
	        			avalon.scan();
	        			return;
	        		}
	        		
	        	},
	        	/*获取当前修改的用户的权限*/
	        	getPower:function(str){
	        		var pw = str.split(',');
	        		for(var k in vm.user_p){
	        			var uk = false;
	        			for(var i=0;i<pw.length;i++){
	        				if(k == pw[i]){
	        					vm.user_p[k] = true;
	        					uk = true;
	        					break;
	        				}
	        			}
	        			if(uk == false){
	        				vm.user_p[k] = false;
	        			}        			
	        		}
	        	},
	        	/*设置权限*/
	        	changerPower:function(str){
	        		vm.user_p[str] = this.checked;
	        	},
	        	/*重置用户密码*/
	        	resetPwd:function(el){
	        		if(vm.user_info.isManager != 1){
	        			TX.msg('您没有权限重置密码',{time:5000});
	        			return;
	        		}
	        		if(vm.user_info.userId == el.userId){
	        			TX.msg('不能重置自己的密码',{time:5000});
	        			return;
	        		}
	        		TX.msg('数据提交中...');
	        		$.post(logic_urls.resetPassword,{userId:el.userId},
	        			function(data){
	        				var json = TX.toJson(data);
	        				if(json.status == 1){
	        					TX.msg('密码重置成功',{time:3000});
	        					avalon.scan();
	        				}else{
	        					TX.msg('重置密码失败' + json.msg,{time:3000});
	        				}
	        			}
	        		);
	        	},
	        	/*准备重置用户密码*/
	        	resetUserPwd:function(el){
	        		layer.confirm('确定要重置此用户的密码吗?',{btn:['确定','取消']},
	        			function(index){
	        				layer.close(index);
	        				vm.resetPwd(el);
	        			},
	        			function(index){
	        				layer.close(index);
	        			}
	        		);
	        	},
	        	/*保存用户信息*/
	        	saveUser:function(){
	        		if(vm.user_dis == 'add'){
	        			var vd = {
	        				userName:vm.user_add.userName,
	        				userPwd:$.md5(vm.user_add.userPwd + $.md5(vm.user_add.userPwd)),
	        				isManager:vm.user_add.isManager
	        			};
	        			TX.msg('正在提交数据');
	        			$.post(logic_urls.saveUsers,vd,
	        				function(data){
	        					var json = TX.toJson(data);
	        					layer.closeAll();
	        					if(json.status == 1){
	        						vm.user_list.push(json.data);
	        						TX.msg('新增用户成功',{time:2000});
	        						vm.changeUserDis('list');
	        						
	        					}else{
	        						TX.msg('新增用户失败:' + json.msg,{time:5000});
	        					}
	        				}
	        			);
	        		}else if(vm.user_dis == 'edit'){
	        			if(vm.user_info.userId != vm.user_edit.userId){
	        				TX.msg('您没有权限修改此用户的密码');
	        				return false;
	        			}
	        			var vd = {
	        				userId:vm.user_edit.userId,
	        				oldPwd:$.md5(vm.user_edit.oldPwd + $.md5(vm.user_edit.oldPwd)),
	        				userPwd:$.md5(vm.user_edit.userPwd + $.md5(vm.user_edit.userPwd))
	        			};
	        			TX.msg('正在提交数据');

	        			$.post(logic_urls.setPassword,vd,
	        				function(data){
	        					var json = TX.toJson(data);
	        					layer.closeAll();
	        					if(json.status == 1){
	        						TX.msg('密码修改成功',{time:3000});
	        						vm.user_dis = 'list';
	        						avalon.scan();
	        					}else{
	        						TX.msg('修改密码失败:' + json.msg,{time:3000});
	        					}
	        				}
	        			);
	        		}else if(vm.user_dis == 'power'){
	        			var pw_str = [];
	        			for(var k in vm.user_p){
	        				if(vm.user_p[k]){
	        					pw_str.push(k);
	        				}
	        			}
	        			var pw = pw_str.join(',');
	        			var vd = {userId:vm.user_edit.userId,power:pw};
	        			TX.msg('正在提交数据');        			
	        			$.post(logic_urls.setUserPower,vd,
	        				function(data){
	        					var json = TX.toJson(data);
	        					console.log(json);
	        					layer.closeAll();
	        					if(json.status == 1){
	        						TX.msg('权限设置成功',{time:3000});
	        						for(var i=0;i<vm.user_list.length;i++){
	        							if(vm.user_list[i]['userId'] == vm.user_edit.userId){
	        								vm.user_list[i]['power'] = json.data;
	        								console.log(vm.user_list[i]['userId'] + '|' + i + '|' + vm.user_edit.userId);
	        								break;
	        							}
	        						}
	        						if(vm.user_edit.userId == vm.user_info.userId){
	        							vm.user_info.power = json.data;
	        							vm.user_power = vm.user_info.power.split(',');
	        						}
	        						vm.user_dis = 'list';
	        						avalon.scan();
	        					}else{
	        						TX.msg('权限设置失败:' + json.msg,{time:3000});
	        					}
	        				}
	        			);
	        		}
	        	},
	        	/*删除用户*/
	        	delUsers:function(el){
	        		if(vm.user_info.isManager != 1){
	        			TX.msg('您没有权限删除用户',{time:5000});
	        			return;
	        		}
	        		TX.msg('数据提交中...');
	        		$.post(logic_urls.deleteUsers,{userId:el.userId},
	        			function(data){
	        				var json = TX.toJson(data);
	        				if(json.status == 1){
	        					TX.msg('删除成功',{time:3000});
	        					for(var k=0;k<=vm.user_list.length;k++){
	        						if(json.data == vm.user_list[k]['userId']){
	        							vm.user_list.splice(k,1);
	        							break;
	        						}
	        					}
	        					avalon.scan();
	        				}else{
	        					TX.msg(json.msg,{time:3000});
	        				}
	        			}
	        		);
	        	},
	        	/*准备删除用户*/
	        	deleteUser(el){
	        		layer.confirm('确定要删除此用户吗?',{btn:['确定','取消']},
	        			function(index){
	        				layer.close(index);
	        				vm.delUsers(el);
	        			},
	        			function(index){
	        				layer.close(index);
	        			}
	        		);
	        	},
	        	/*
	        	*车辆相关
	        	*/
	        	/*切换车辆功能模式*/
	        	changeTruckDis:function(tp,el){
	        		if(tp == 'list'){
	        			vm.truck_dis = tp;
	        			avalon.scan();
	        			return;
	        		}else if(tp == 'add'){
	        			vm.truck_add = {
	        				truckCode:'',
	        				driver:'',
	        				truckType:'',
	        				dataFlag:1
	        			};
	        			vm.truck_dis = tp;
	        			avalon.scan();
	        		}else if(tp == 'edit'){
	        			console.log(el);
	        			vm.truck_edit = el;
	        			vm.truck_dis = tp;
	        			avalon.scan();
	        		}
	        	},
	        	/*根据typeId获取车辆类型*/
	        	getTruckTypeDesc:function(id){
	        		var tp = '';
					for(var i=0;i<vm.truck_type_list.length;i++){
						if(vm.truck_type_list[i]['typeId'] == id){
							tp = vm.truck_type_list[i]['typeName'];
							break;
						}
					}
					return tp;
	        	},
	        	/*保存车辆信息*/
	        	saveTruck:function(data){
	        		if(vm.truck_dis == 'add'){
	        			var vd = {
	        				truckCode:vm.truck_add.truckCode,
	        				driver:vm.truck_add.driver,
	        				truckOwner:vm.truck_add.truckOwner,
	        				truckType:vm.truck_add.truckType,
	        				dataFlag:1
	        			};
	        			TX.msg('正在提交数据');
	        			$.post(logic_urls.truckAdd,vd,
	        				function(data){
	        					layer.closeAll();
	        					var json = TX.toJson(data);
	        					if(json.status == 1){
	        						var sd = {
	        							truckId:json.data.truckId,
	        							truckCode:json.data.truckCode,
	        							truckOwner:json.data.truckOwner,
	        							driver:json.data.driver,
	        							dataFlag:json.data.dataFlag,
	        							truckType:json.data.truckType,
	        							typeName:vm.getTruckTypeDesc(json.data.truckType),
	        							emptyWeigh:'0.00',
	        							weighDate:'',
	        							emptyOperator:''
	        						};
	        						console.log(sd);
	        						vm.truck_list.push(sd);
	        						vm.truck_dis = 'list';
	        						TX.msg('新增车辆成功',{time:3000});
	        						avalon.scan();
	        					}else{
	        						TX.msg('' + json.msg,{time:3000});
	        					}
	        				}
	        			);
	        		}else if(vm.truck_dis == 'edit'){
	        			var vd = {
	        				truckId:vm.truck_edit.truckId,
	        				truckCode:vm.truck_edit.truckCode,
	        				driver:vm.truck_edit.driver,
	        				truckOwner:vm.truck_edit.truckOwner,
	        				truckType:vm.truck_edit.truckType,
	        				dataFlag:vm.truck_edit.dataFlag
	        			};
	        			TX.msg('正在提交数据');
	        			$.post(logic_urls.truckSave,vd,
	        				function(data){
	        					layer.closeAll();
	        					var json = TX.toJson(data);
	        					console.log(json);
	        					if(json.status == 1){
	        						for(var i=0;i<vm.truck_list.length;i++){
	        							if(vm.truck_list[i]['truckId'] == vm.truck_edit.truckId){
	        								vm.truck_list.splice(i,1,vm.truck_edit);
	        							}
	        						}
	        						vm.truck_dis = 'list';
	        						TX.msg('编辑车辆成功',{time:3000});
	        						avalon.scan();
	        					}else{
	        						TX.msg('' + json.msg,{time:3000});
	        					}
	        				}
	        			);
	        		}
	        	},
	        	/*删除车辆信息*/
	        	deleteTruck:function(id){
	        		if(vm.user_info.isManager != 1){
	        			TX.msg('您没有权限删除用户',{time:5000});
	        			return;
	        		}
	        		TX.msg('正在提交数据,请稍后...');
	        		$.post(logic_urls.truckDel,{truckId:id},
	        			function(data){
	        				layer.closeAll();
	    					var json = TX.toJson(data);
	    					if(json.status == 1){
	    						for(var i=0;i<vm.truck_list.length;i++){
	    							if(vm.truck_list[i]['truckId'] == json.data){
	    								vm.truck_list.splice(i,1);
	    							}
	    						}
	    						vm.truck_dis = 'list';
	    						TX.msg('删除车辆成功',{time:3000});
	    						avalon.scan();
	    					}else{
	    						TX.msg('删除车辆失败' + json.msg,{time:3000});
	    					}
	        			}
	        		);
	        	},
	        	/*准备删除车辆*/
	        	delTruck:function(id){
	        		layer.confirm('确定要删除此车辆吗?',{btn:['确定','取消']},
	        			function(index){
	        				layer.close(index);
	        				vm.deleteTruck(id);
	        			},
	        			function(index){
	        				layer.close(index);
	        			}
	        		);
	        	},
	        	/***
	        	*
	        	*用户相关
	        	*
	        	***/
	        	customerToEdit:function(id,el){
	        		if(id > 0){
	        			var arr = el.receiveHouse.split(',');
	        			vm.customer_edit = el;
	        			vm.changeCustomerSelect(arr);	  
	        			avalon.scan();      			
	        		}else{
	        			vm.resetCustomerSelect();
	        			vm.customer_edit = {
	        				customerId:0,
	        				customerName:'',
	        				address:'',
	        				phone:'',
	        				receiveHouse:'',
	        				dataFlag:1
	        			};
	        		}
	        		vm.customer_dis = 'edit';
	        	},
	        	customerSave:function(){
	        		var selectArr = [];
	        		var selectStr = '';
	        		for(var i=0;i<vm.house_list.length;i++){
	        			if(vm.house_list[i]['selected'] == 1){
	        				selectArr.push(vm.house_list[i]['houseId']);
	        			}
	        			if(selectArr.length > 0){
	        				selectStr = selectArr.join(',');
	        			}
	        		}
	        		var vd = {
	        			customerId:vm.customer_edit.customerId,
	        			customerName:vm.customer_edit.customerName,
	        			address:vm.customer_edit.address,
	        			phone:vm.customer_edit.phone,
	        			dataFlag:vm.customer_edit.dataFlag,
	        			receiveHouse:selectStr
	        		};
	        		TX.msg('正在提交数据,请稍后...');
	        		$.post(logic_urls.customerSave,vd,
	        			function(data){
							layer.closeAll();
							var json = TX.toJson(data);
							if(json.status == 1){
								if(json.model == 1){
									for(var i=0;i<vm.customer_list.length;i++){
										if(vm.customer_list[i]['customerId'] == vd['customerId']){
											vm.customer_list.splice(i,1,vd);
											break;
										}
									}
								}else{
									vm.customer_list.push(json.data);
								}
								vm.customer_dis = 'list';
								avalon.scan();
							}else{
								TX.msg('保存数据失败,错误代码为:' + json.msg ,{time:3000});
							}
	        			}
	        		);
	        		/*在更新完成后,还需要更新customer_list中的receiveHost*/
	        	},
	        	changeCustomerSelect:function(arr){
	        		if(arr.length == 0){
	        			vm.resetCustomerSelect();
	        			return;
	        		}
	        		for(var i=0;i<vm.house_list.length;i++){
	        			for(var k=0;k<arr.length;k++){
	        				if(arr[k] == vm.house_list[i]['houseId']){
	        					vm.house_list[i]['selected'] = 1;
	        					break;
	        				}
	        				vm.house_list[i]['selected'] = 0;
	        			}
	        		}
	        		vm.setCustomerClass();
	        		console.log(vm.customer_list);
	        	},
	        	setCustomerSelect:function(id){
	        		if(vm.house_list[id]['selected'] == 1){
	        			vm.house_list[id]['selected'] = 0;
	        		}else{
	        			vm.house_list[id]['selected'] = 1;
	        		}
	        		vm.setCustomerClass();
	        		console.log(vm.house_list);
	        	},
	        	resetCustomerSelect:function(){
	        		for(var i=0;i<vm.house_list.length;i++){
	        			vm.house_list[i]['selected'] = 0;
	        		}
	        		vm.setCustomerClass();
	        	},
	        	customerReturn:function(){
	        		vm.customer_dis = 'list';
	        	},
	        	setCustomerClass:function(){
	        		for(var i=0;i<vm.house_list.length;i++){
	        			if(vm.house_list[i]['selected'] == 1){
	        				$("#customer-selected p").eq(i).addClass('customer-selected');
	        			}else{
	        				$("#customer-selected p").eq(i).removeClass('customer-selected');
	        			}
	        			
	        		}
	        	},
	        	toDelCustomer:function(id){
	        		layer.confirm('确定要删除此单位吗?',{btn:['确定','取消']},
	        			function(index){
	        				layer.close(index);
	        				vm.customerDel(id);
	        			},
	        			function(index){
	        				layer.close(index);
	        			}
	        		);
	        	},
	        	customerDel:function(id){
	        		TX.msg('正在提交数据,请稍后...');
	        		$.post(logic_urls.customerDel,{customerId:id},
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								for(var i=0;i<vm.customer_list.length;i++){
									if(id == vm.customer_list[i]['customerId']){
										vm.customer_list.splice(i,1);
										break;
									}
								}
								avalon.scan();
							}else{
								TX.msg('删除数据失败,错误代码为:' + json.msg ,{time:3000});
							}
	        			}
	        		);
	        	},
	        	goodsEdit:function(id,el){
	        		if(id > 0){
	        			for(var k in el){
	        				vm.goods_edit[k] = el[k];
	        			}
	        		}else{
	        			vm.goods_edit = {
	        				goodsId:0,
	        				goodsName:'',
	        				dataFlag:1
	        			};
	        		}
	        		vm.goods_dis = 'edit';
	        		console.log(vm.goods_edit);
	        		avalon.scan();
	        	},
	        	goodsSave:function(){
	        		var vd = {
	        			goodsId:vm.goods_edit.goodsId,
	        			goodsName:vm.goods_edit.goodsName,
	        			dataFlag:vm.goods_edit.dataFlag
	        		};
	        		$.post(logic_urls.goodsSave,vd,
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								if(json.model == 0){
									vm.goods_list.push(json.data);
								}else{
									for(var i=0;i<vm.goods_list.length;i++){
										if(vm.goods_edit.goodsId == vm.goods_list[i]['goodsId']){
											vm.goods_list.splice(i,1,json.data);
											break;
										}
									}
								}
								vm.goods_dis = 'list';
								avalon.scan();
							}else{
								TX.msg('保存物资失败,代码为:' + json.msg,{time:3000});
							}
	        			}
	        		);
	        	},
	        	toDelGoods:function(id){
	        		layer.confirm('确定要删除此物资吗?',{btn:['确定','取消']},
	        			function(index){
	        				layer.close(index);
	        				vm.goodsDel(id);
	        			},
	        			function(index){
	        				layer.close(index);
	        			}
	        		);
	        	},
	        	goodsDel:function(id){
	        		if(id <= 0){
	        			TX.msg('请正确选择要删除的物资',{time:5000});
	        			return;
	        		}
	        		TX.msg('正在提交数据,请稍后...');
	        		$.post(logic_urls.goodsDel,{goodsId:id},
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								for(var i=0;i<vm.goods_list.length;i++){
									if(id == vm.goods_list[i]['goodsId']){
										vm.goods_list.splice(i,1);
										break;
									}
								}
							}else{
								TX.msg('删除物资失败,代码为:' + json.msg,{time:3000});
							}
	        			}
	        		);
	        	},
	        	goodsReturn:function(){
	        		vm.goods_dis = 'list';
	        	},
	        	excavatorEdit:function(id,el){
	        		if(id > 0){
	        			for(var k in el){
	        				vm.excavator_edit[k] = el[k];
	        			}
	        		}else{
	        			vm.excavator_edit = {
	        				excavatorId:0,
	        				excavatorCode:'',
	        				dataFlag:1
	        			};
	        		}
	        		vm.excavator_dis = 'edit';
	        		console.log(vm.excavator_edit);
	        		avalon.scan();
	        	},
	        	excavatorSave:function(){
	        		var vd = {
	        			excavatorId:vm.excavator_edit.excavatorId,
	        			excavatorCode:vm.excavator_edit.excavatorCode,
	        			dataFlag:vm.excavator_edit.dataFlag
	        		};
	        		$.post(logic_urls.excavatorSave,vd,
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								if(json.model == 0){
									vm.excavator_list.push(json.data);
								}else{
									for(var i=0;i<vm.excavator_list.length;i++){
										if(vm.excavator_edit.excavatorId == vm.excavator_list[i]['excavatorId']){
											vm.excavator_list.splice(i,1,json.data);
											break;
										}
									}
								}
								vm.excavator_dis = 'list';
								avalon.scan();
							}else{
								TX.msg('保存钩机号失败,代码为:' + json.msg,{time:3000});
							}
	        			}
	        		);
	        	},
	        	toDelExcavator:function(id){
	        		layer.confirm('确定要删除此钩机号吗?',{btn:['确定','取消']},
	        			function(index){
	        				layer.close(index);
	        				vm.excavatorDel(id);
	        			},
	        			function(index){
	        				layer.close(index);
	        			}
	        		);
	        	},
	        	excavatorDel:function(id){
	        		if(id <= 0){
	        			TX.msg('请正确选择要删除的钩机号',{time:5000});
	        			return;
	        		}
	        		TX.msg('正在提交数据,请稍后...');
	        		$.post(logic_urls.excavatorDel,{excavatorId:id},
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								for(var i=0;i<vm.excavator_list.length;i++){
									if(id == vm.excavator_list[i]['excavatorId']){
										vm.excavator_list.splice(i,1);
										break;
									}
								}
							}else{
								TX.msg('删除钩机号失败,代码为:' + json.msg,{time:3000});
							}
	        			}
	        		);
	        	},
	        	excavatorReturn:function(){
	        		vm.excavator_dis = 'list';
	        	},
	        	/*磅房相关*/
	        	houseEdit:function(id,el){
	        		if(id > 0){
	        			for(var k in el){
	        				vm.house_edit[k] = el[k];
	        			}
	        		}else{
	        			vm.house_edit = {
	        				houseId:0,
	        				houseName:'',
	        				dataFlag:1
	        			};
	        		}
	        		vm.house_dis = 'edit';
	        		console.log(vm.house_edit);
	        		avalon.scan();
	        	},
	        	houseSave:function(){
	        		var vd = {
	        			houseId:vm.house_edit.houseId,
	        			houseName:vm.house_edit.houseName,
	        			dataFlag:vm.house_edit.dataFlag
	        		};
	        		$.post(logic_urls.houseSave,vd,
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								if(json.model == 0){
									vm.house_list.push(json.data);
								}else{
									for(var i=0;i<vm.house_list.length;i++){
										if(vm.house_edit.houseId == vm.house_list[i]['houseId']){
											vm.house_list.splice(i,1,json.data);
											break;
										}
									}
								}
								vm.house_dis = 'list';
								avalon.scan();
							}else{
								TX.msg('保存磅房失败,代码为:' + json.msg,{time:3000});
							}
	        			}
	        		);
	        	},
	        	toDelHouse:function(id){
	        		layer.confirm('确定要删除此磅房吗?',{btn:['确定','取消']},
	        			function(index){
	        				layer.close(index);
	        				vm.houseDel(id);
	        			},
	        			function(index){
	        				layer.close(index);
	        			}
	        		);
	        	},
	        	houseDel:function(id){
	        		if(id <= 0){
	        			TX.msg('请正确选择要删除的磅房',{time:5000});
	        			return;
	        		}
	        		TX.msg('正在提交数据,请稍后...');
	        		$.post(logic_urls.houseDel,{houseId:id},
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								for(var i=0;i<vm.house_list.length;i++){
									if(id == vm.house_list[i]['houseId']){
										vm.house_list.splice(i,1);
										break;
									}
								}
							}else{
								TX.msg('删除磅房失败,代码为:' + json.msg,{time:3000});
							}
	        			}
	        		);
	        	},
	        	houseReturn:function(){
	        		vm.house_dis = 'list';
	        	},
	        	/*车辆型号相关*/
	        	trucktypeEdit:function(id,el){
	        		if(id > 0){
	        			for(var k in el){
	        				vm.truck_type_edit[k] = el[k];
	        			}
	        		}else{
	        			vm.truck_type_edit = {
	        				typeId:0,
	        				typeName:''
	        			};
	        		}
	        		vm.truck_type_dis = 'edit';
	        		console.log(vm.truck_type_edit);
	        		avalon.scan();
	        	},
	        	trucktypeSave:function(){
	        		var vd = {
	        			typeId:vm.truck_type_edit.typeId,
	        			typeName:vm.truck_type_edit.typeName
	        		};
	        		$.post(logic_urls.trucktypeSave,vd,
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								if(json.model == 0){
									vm.truck_type_list.push(json.data);
								}else{
									for(var i=0;i<vm.truck_type_list.length;i++){
										if(vm.truck_type_edit.typeId == vm.truck_type_list[i]['typeId']){
											vm.truck_type_list.splice(i,1,json.data);
											break;
										}
									}
								}
								vm.truck_type_dis = 'list';
								avalon.scan();
							}else{
								TX.msg('保存车辆类型失败,代码为:' + json.msg,{time:3000});
							}
	        			}
	        		);
	        	},
	        	toDelTrucktype:function(id){
	        		layer.confirm('确定要删除此车辆类型吗?',{btn:['确定','取消']},
	        			function(index){
	        				layer.close(index);
	        				vm.trucktypeDel(id);
	        			},
	        			function(index){
	        				layer.close(index);
	        			}
	        		);
	        	},
	        	trucktypeDel:function(id){
	        		if(id <= 0){
	        			TX.msg('请正确选择要删除的车辆类型',{time:5000});
	        			return;
	        		}
	        		TX.msg('正在提交数据,请稍后...');
	        		$.post(logic_urls.trucktypeDel,{typeId:id},
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								for(var i=0;i<vm.truck_type_list.length;i++){
									if(id == vm.truck_type_list[i]['typeId']){
										vm.truck_type_list.splice(i,1);
										break;
									}
								}
							}else{
								TX.msg('删除车辆类型失败,代码为:' + json.msg,{time:3000});
							}
	        			}
	        		);
	        	},
	        	trucktypeReturn:function(){
	        		vm.truck_type_dis = 'list';
	        	},
	        	/*发货位置相关*/
	        	positionEdit:function(id,el){
	        		if(id > 0){
	        			for(var k in el){
	        				vm.position_edit[k] = el[k];
	        			}
	        		}else{
	        			vm.position_edit = {
	        				positionId:0,
	        				position:'',
	        				dataFlag:1,
	        				customreId:0
	        			};
	        		}
	        		vm.position_dis = 'edit';
	        		console.log(vm.position_edit);
	        		avalon.scan();
	        	},
	        	positionSave:function(){
	        		var vd = {
	        			positionId:vm.position_edit.positionId,
	        			position:vm.position_edit.position,
	        			dataFlag:vm.position_edit.dataFlag,
	        			customerId:vm.position_edit.customerId
	        		};
	        		if(vd.customerId == 0){
	        			TX.msg('请选择所属单位',{time:3000});
	        			return;
	        		}
	        		$.post(logic_urls.positionSave,vd,
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								if(json.model == 0){
									var pd = json.data;
									for(var sk=0;sk<vm.customer_list.length;sk++){
										if(vm.customer_list[sk]['customerId'] == pd['customerId']){
											pd['unit'] = vm.customer_list[sk]['customerName'];
											break;
										}
									}
									vm.position_list.push(pd);
								}else{
									for(var i=0;i<vm.position_list.length;i++){
										if(vm.position_edit.positionId == vm.position_list[i]['positionId']){
											var pd = json.data;
											for(var sk=0;sk<vm.customer_list.length;sk++){
												if(vm.customer_list[sk]['customerId'] == pd['customerId']){
													pd['unit'] = vm.customer_list[sk]['customerName'];
													break;
												}
											}
											vm.position_list.splice(i,1,pd);
											break;
										}
									}
								}
								vm.position_dis = 'list';
								avalon.scan();
							}else{
								TX.msg('保存发货位置失败,代码为:' + json.msg,{time:3000});
							}
	        			}
	        		);
	        	},
	        	toDelPosition:function(id){
	        		layer.confirm('确定要删除此发货位置吗?',{btn:['确定','取消']},
	        			function(index){
	        				layer.close(index);
	        				vm.positionDel(id);
	        			},
	        			function(index){
	        				layer.close(index);
	        			}
	        		);
	        	},
	        	positionDel:function(id){
	        		if(id <= 0){
	        			TX.msg('请正确选择要删除的发货位置',{time:5000});
	        			return;
	        		}
	        		TX.msg('正在提交数据,请稍后...');
	        		$.post(logic_urls.positionDel,{positionId:id},
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								for(var i=0;i<vm.position_list.length;i++){
									if(id == vm.position_list[i]['positionId']){
										vm.position_list.splice(i,1);
										break;
									}
								}
							}else{
								TX.msg('删除发货位置失败,代码为:' + json.msg,{time:3000});
							}
	        			}
	        		);
	        	},
	        	positionReturn:function(){
	        		vm.position_dis = 'list';
	        	},
	        	/*发运路线相关*/
	        	routeEdit:function(id,el){
	        		if(id > 0){
	        			for(var k in el){
	        				vm.route_edit[k] = el[k];
	        			}
	        		}else{
	        			vm.route_edit = {
	        				routeId:0,
	        				route:'',
	        				dataFlag:1
	        			};
	        		}
	        		vm.route_dis = 'edit';
	        		console.log(vm.route_edit);
	        		avalon.scan();
	        	},
	        	routeSave:function(){
	        		var vd = {
	        			routeId:vm.route_edit.routeId,
	        			route:vm.route_edit.route,
	        			dataFlag:vm.route_edit.dataFlag
	        		};
	        		$.post(logic_urls.routeSave,vd,
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								if(json.model == 0){
									vm.route_list.push(json.data);
								}else{
									for(var i=0;i<vm.route_list.length;i++){
										if(vm.route_edit.routeId == vm.route_list[i]['routeId']){
											vm.route_list.splice(i,1,json.data);
											break;
										}
									}
								}
								vm.route_dis = 'list';
								avalon.scan();
							}else{
								TX.msg('保存发货位置失败,代码为:' + json.msg,{time:3000});
							}
	        			}
	        		);
	        	},
	        	toDelRoute:function(id){
	        		layer.confirm('确定要删除此发货位置吗?',{btn:['确定','取消']},
	        			function(index){
	        				layer.close(index);
	        				vm.routeDel(id);
	        			},
	        			function(index){
	        				layer.close(index);
	        			}
	        		);
	        	},
	        	routeDel:function(id){
	        		if(id <= 0){
	        			TX.msg('请正确选择要删除的发货位置',{time:5000});
	        			return;
	        		}
	        		TX.msg('正在提交数据,请稍后...');
	        		$.post(logic_urls.routeDel,{routeId:id},
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								for(var i=0;i<vm.route_list.length;i++){
									if(id == vm.route_list[i]['routeId']){
										vm.route_list.splice(i,1);
										break;
									}
								}
							}else{
								TX.msg('删除发货位置失败,代码为:' + json.msg,{time:3000});
							}
	        			}
	        		);
	        	},
	        	routeReturn:function(){
	        		vm.route_dis = 'list';
	        	},
	        	/*配置相关*/
	        	configEdit:function(id,el){
	        		if(id > 0){
	        			for(var k in el){
	        				vm.config_edit[k] = el[k];
	        			}
	        		}else{
	        			vm.config_edit = {
	        				configId:0,
	        				company:'',
	        				codeLeft:'',
	        				backupUrl:'',
	        				weighModel:0,
	        				isTest:0,
	        				isDebug:0,
	        				normalLen:7,
	        				tempLen:3,
	        				lockTime:0,
	        				printHead:'',
	        				printEnd:'',
	        				dataFlag:1,
	        				houseId:0,
	        				codeType:0,
	        				codeLen:0,
	        				portName:'COM1',
	        				baudRate:'4800',
	        				dataBit:8,
	        				checkBit:'None',
	        				stopBit:1,
	        				cacheLen:10,
	        				codePrintarea:'220mm,85mm',
	        				codePagearea:'2200,855',
	        				reportPagearea:'3700,2200',
	        				reportPrintarea:'3600mm,2200mm',
	        				pageName:'报表',
	        				timeAreareport:0,
	        				weighInterval:0,
	        				video:0,
	        				cameraIp:'',
	        				cameraUser:'',
	        				cameraPwd:'',
	        				picUrl:'',
	        				serverPicurl:''
	        			};
	        		}
	        		vm.config_dis = 'edit';
	        		console.log(vm.config_edit);
	        		avalon.scan();
	        	},
	        	configSave:function(){
	        		var vd = {
	        			configId:vm.config_edit.configId,
        				company:vm.config_edit.company,
        				codeLeft:vm.config_edit.codeLeft,
        				backupUrl:vm.config_edit.backupUrl,
        				weighModel:vm.config_edit.weighModel,
        				isTest:vm.config_edit.isTest,
        				isDebug:vm.config_edit.isDebug,
        				normalLen:vm.config_edit.normalLen,
        				tempLen:vm.config_edit.tempLen,
        				lockTime:vm.config_edit.lockTime,
        				printHead:vm.config_edit.printHead,
        				printEnd:vm.config_edit.printEnd,
        				dataFlag:vm.config_edit.dataFlag,
        				houseId:vm.config_edit.houseId,
        				codeType:vm.config_edit.codeType,
        				codeLen:vm.config_edit.codeLen,
        				portName:vm.config_edit.portName,
        				baudRate:vm.config_edit.baudRate,
        				dataBit:vm.config_edit.dataBit,
        				checkBit:vm.config_edit.checkBit,
        				stopBit:vm.config_edit.stopBit,
        				cacheLen:vm.config_edit.cacheLen,
        				codePrintarea:vm.config_edit.codePrintarea,
        				codePagearea:vm.config_edit.codePagearea,
        				reportPagearea:vm.config_edit.reportPagearea,
        				reportPrintarea:vm.config_edit.reportPrintarea,
        				pageName:vm.config_edit.pageName,
        				timeAreareport:vm.config_edit.timeAreareport,
        				dataFlag:vm.config_edit.dataFlag,
        				video:vm.config_edit.video,
        				cameraIp:vm.config_edit.cameraIp,
        				cameraUser:vm.config_edit.cameraUser,
        				cameraPwd:vm.config_edit.cameraPwd,
        				picUrl:vm.config_edit.picUrl,
        				serverPicurl:vm.config_edit.serverPicurl
	        		};
	        		$.post(logic_urls.configSave,vd,
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								for(var i=0;i<vm.house_list.length;i++){
									if(json.data.houseId == vm.house_list[i]['houseId']){
										json.data.houseName = vm.house_list[i]['houseName'];
										break;
									}
								}
								if(json.model == 0){									
									vm.config_list.push(json.data);
								}else{
									for(var i=0;i<vm.config_list.length;i++){
										if(vm.config_edit.configId == vm.config_list[i]['configId']){
											vm.config_list.splice(i,1,json.data);
											break;
										}
									}
								}
								vm.config_dis = 'list';
								avalon.scan();
							}else{
								TX.msg('保存配置失败,代码为:' + json.msg,{time:3000});
							}
	        			}
	        		);
	        	},
	        	toDelConfig:function(id){
	        		layer.confirm('确定要删除此配置吗?',{btn:['确定','取消']},
	        			function(index){
	        				layer.close(index);
	        				vm.configDel(id);
	        			},
	        			function(index){
	        				layer.close(index);
	        			}
	        		);
	        	},
	        	configDel:function(id){
	        		if(id <= 0){
	        			TX.msg('请正确选择要删除的配置',{time:5000});
	        			return;
	        		}
	        		TX.msg('正在提交数据,请稍后...');
	        		$.post(logic_urls.configDel,{configId:id},
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								for(var i=0;i<vm.config_list.length;i++){
									if(id == vm.config_list[i]['configId']){
										vm.config_list.splice(i,1);
										break;
									}
								}
							}else{
								TX.msg('删除配置失败,代码为:' + json.msg,{time:3000});
							}
	        			}
	        		);
	        	},
	        	configReturn:function(){
	        		vm.config_dis = 'list';
	        	},
	        	serialnumberSave:function(){
	        		TX.msg('正在提交数据,请稍后...');
	        		$.post(logic_urls.serialnumberSave,{serialNumber:vm.serialNumber},
	        			function(data){
	        				layer.closeAll();
							var json = TX.toJson(data);
							console.log(json);
							if(json.status == 1){
								TX.msg('修改流水号成功',{time:3000});
							}else{
								TX.msg('修改流水号出错,错误代码为' + json.msg,{time:3000});
							}
	        			}
	        		);
	        	}

	        });
			vm.load();
		});
	</script>
</body>
</html>